package baseFx.tests.database;

import baseFx.database.*;
import baseFx.database.query.PageSet;

import java.util.List;

public class AbstractSqlTests {
    public static void main(String[] args) {

        TestAbstractSql sql = new TestAbstractSql();
        sql.execute("select * from t where id=#id and status in #s", new Object() {
            public int[] s = {1, 2, 3};
            public int id = 5;
        });
    }

    private static class TestAbstractSql extends AbstractSql {

        @Override
        protected int onExecute(SqlParam param) {
            System.out.println(param.command);
            for (String k : param.args.keySet()) {
                System.out.println(k + " = " + param.args.get(k));
            }
            return 0;
        }

        @Override
        protected <T> List<T> onQuery(Class<T> clazz, SqlParam param) {
            return null;
        }

        @Override
        protected MultipleReader onMultiple(SqlParam param) {
            return null;
        }

        @Override
        protected <T> void onPager(Class<T> clazz, PageSet pageSet, SqlParam param) {

        }

        @Override
        protected <T> CursorReader<T> onCursor(Class<T> clazz, SqlParam param, int fetchSize, boolean independent) {
            return null;
        }

        @Override
        protected void beginTransaction(TransactionLevel level) {

        }

        @Override
        protected void commitTransaction() {

        }

        @Override
        protected void rollbackTransaction() {

        }

        @Override
        public String placeholder(String name) {
            return "?";
        }

        @Override
        public void changeDataSource(String key) {

        }

        @Override
        public String paramName(String name) {
            return null;
        }

        @Override
        public String escapeField(String field) {
            return null;
        }

        @Override
        public boolean isClosed() {
            return false;
        }
    }
}
